//package com.ecjtu.stadiumre_servations.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.cors.CorsConfiguration;
//
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
//import org.springframework.web.filter.CorsFilter;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Configuration
//public class MyWebMVCConfigure implements WebMvcConfigurer {
//    @Bean
//    public CorsFilter  corsFilter() {
//        //创建跨域配置对象
//        CorsConfiguration conf=new CorsConfiguration();
//        conf.addAllowedHeader("*"); //允许携带任何请求头
//        conf.addAllowedMethod("*"); //允许所有的请求方式
//        conf.addAllowedOrigin("*"); //允许任意域不同
//        //允许携带cookie
//        conf.setAllowCredentials(true); //允许跨域携带cookie
//        conf.setMaxAge(3600L);
//        conf.addExposedHeader("set-cookie");
//        conf.addExposedHeader("access-control-allow-origin");
//        conf.addExposedHeader("access-control-allow-header");
//        conf.addExposedHeader("access-control-allow-origin");
//        conf.addExposedHeader("access-control-max-age");
//        conf.addExposedHeader("X-Frame-Options");
//        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//        source.registerCorsConfiguration("/**",conf);
//        return new CorsFilter(source);
//    }
//}
